<?php

class Minipage_WebController extends Zend_Controller_Action
{

    public function init()
    {

    }
    /**
     * Show homepage
     * 
     * @throws Exception if home path not found
     */
    public function indexAction()
    {
        try {
            $homePath = realpath(APPLICATION_PATH . '/../home/default/minipage');

            if($homePath === FALSE) {
                throw new Exception('Home path not found!');
            }
            $layout = Zend_Layout::getMvcInstance();
            // Set a layout script path
            $layout->setLayoutPath($homePath);
            // Set a view script path:
            $this->view->addScriptPath($homePath);
            // Load header data
            $head = new Zend_Config_Ini($homePath . '/index.ini', 'head');
            $this->view->headTitle($head->title);

            $meta = array();
            $meta = $head->meta;

            foreach ($meta as $type => $content) {
                $this->view->headMeta()->appendName($type, $content);
            }
            // Rending the view index.phtml
            $this->render('index', null, true);

        } catch (Exception $e) {
            // TODO: layout must be disabled or be redirected to a error app
            error_log($e);
        }
    }
}